import { GET, PUT, POST } from './request'
import {
  phoneLoginParams,
  sendCodeParams,
  GetUserListParams,
  PutMeParams
} from './user.d'

/**
 * 手机号 + 验证码登录
 * @param  {String} phone      手机号
 * @param  {String} code       验证码
 */
export const phoneLogin = (data:phoneLoginParams) => POST('/login/phoneAndCode', data)

/**
 * 发送验证码
 */
export const sendCode = (data:sendCodeParams) => POST('/sms/sendCode', data)

/**
 * 获取个人信息
 * @param {Boolean} hold 请求失败是否不跳转登录
 */
export const getMe = (hold = false) => GET('/userInfo/me', {}, { hold })

/**
 * 获取用户列表
 * @param {String} keyWord 关键字
 * @param {Number} pageNum
 * @param {Number} pageSize
 */
export const getUserList = (params:GetUserListParams) => GET('/userOperate/getUserRoughInfoByVague', params)

/**
 * 修改个人基本资料
 */
export const putMe = (data:PutMeParams) => PUT('/userInfo/me', data)
